#include <string>
#include <vector>
#include <map>

#include <boost/cstdint.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>

#ifndef _KUAI_TYPEDEF_H_
#define _KUAI_TYPEDEF_H_

namespace kuai {

#ifdef USE_DOUBLE
	typedef double			RealNumber;
	typedef boost::uint32_t	Index;
	typedef boost::int32_t	Integer;
	typedef Index			Size;
	typedef boost::uint64_t	BigIndex;
	typedef BigIndex		BigSize;
#else
	typedef float			RealNumber;
	typedef boost::uint16_t	Index;
	typedef boost::int16_t	Integer;
	typedef Index			Size;
	typedef size_t			BigIndex;
	typedef size_t			BigSize;
#endif
	typedef void*			Handle;
	typedef char			Char;
	typedef boost::int16_t	Short;

	typedef unsigned char	Byte;

	typedef std::vector<Byte> ByteArray;

	enum {
		INVALID_INDEX = Index(-1)
	};

	typedef std::string String;
	typedef std::vector<String> StringArray;
	typedef std::pair<String, String> StringPair;

	typedef std::map<String, String> StringMap;

	typedef boost::posix_time::ptime Time;

	template<typename T>
	inline bool isZero(const std::vector<T>& v0) {
		for (size_t i = 0; i < v0.size(); ++i) {
			if (v0[i] != 0) {
				return false;
			}
		}
		return true;
	}

	typedef std::vector<Index> IndexArray;
	typedef std::pair<size_t, size_t> SizePair;
}

#define arrayLength(a) (sizeof(a) / sizeof(a[0]))


#endif
